Workload Analysis
Analyze individual workload by evaluating tasks and projects, providing proactive insights and predictive recommendations to optimize productivity and resource allocation.
Instructions
Comprehensive workload analysis with proactive insights and predictive recommendations
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignee | Yes | Person to analyze (e.g., "John", "Jane") |
Implementation Reference
- The MCP tool handler function that orchestrates the workload analysis by instantiating the processor class and formatting the response as MCP content.handler: async ({ assignee }: { assignee: string }) => { try { const processor = new WorkloadAnalysisProcessor(process.env.MCP_DEBUG_MODE === 'true'); const analysis = await processor.analyzeWorkload(assignee); // SAFETY: Ensure analysis is valid if (!analysis) { throw new Error('Workload analysis returned null or undefined'); } return { content: [ { type: 'text', text: JSON.stringify( { assignee: analysis.assignee || assignee, summary: `${analysis.assignee || assignee}: ${analysis.totalTasks || 0} tasks, ${analysis.workloadScore || 0}/100 score, ${analysis.efficiency || 0}% efficiency`, workload_score: analysis.workloadScore || 0, efficiency: analysis.efficiency || 0, capacity_utilization: analysis.capacityUtilization || 0, velocity_trend: analysis.velocityTrend || 'STABLE', status_breakdown: analysis.statusBreakdown || { TODO: 0, IN_PROGRESS: 0, COMPLETED: 0, BLOCKED: 0, }, overdue_tasks: analysis.overdueTasks || 0, risk_factors: analysis.riskFactors || [], insights: analysis.insights || [], recommendations: analysis.recommendations || [], prediction: analysis.prediction || null, team_context: analysis.teamContext || null, requires_attention: (analysis.workloadScore || 0) > 80 || (analysis.riskFactors || []).length > 1, }, null, 2, ), }, ], }; } catch (error) { console.error(`[WorkloadAnalysis] Handler failed:`, error); return { content: [ { type: 'text', text: JSON.stringify( { assignee, success: false, error: (error as Error).message, summary: `Failed to analyze workload for ${assignee}`, insights: ['Workload analysis unavailable'], recommendations: ['Check system connectivity and try again'], }, null, 2, ), }, ], }; } },
- Zod input schema validation for the tool parameters.parameters: z.object({ assignee: z .string() .min(1, 'Assignee name is required') .max(100, 'Assignee name too long') .describe('Person name to analyze workload for (e.g., "John", "Jane")'), }),
- src/mcp/tools/index.ts:12-16 (registration)Centralized export of all MCP tools including Workload Analysis in the mcpTools array.import { workloadAnalysisTool } from './workload_analysis'; import { riskAssessmentTool } from './risk_assessment'; // EXPANSION: Consolidated tool registry for MCP server export const mcpTools = [naturalLanguageQueryTool, workloadAnalysisTool, riskAssessmentTool];
- src/mcp/server.ts:28-33 (registration)MCP server lists the registered tools in response to ListToolsRequest using mcpTools.tools: mcpTools.map(tool => ({ name: tool.name, description: tool.description, inputSchema: this.getInputSchema(tool.name), })), };
- Core workload analysis logic in WorkloadAnalysisProcessor.analyzeWorkload method, which fetches base data, enhances it, adds predictions and team context.async analyzeWorkload(assignee: string): Promise<EnhancedWorkloadAnalysis> { const startTime = Date.now(); try { this.debug(`Analyzing workload for: ${assignee}`); // CACHE: Check for recent analysis const cacheKey = `workload:analysis:${assignee.toLowerCase()}`; let cachedAnalysis = await CacheService.get<EnhancedWorkloadAnalysis>(cacheKey); if (cachedAnalysis) { this.debug(`Retrieved cached analysis for ${assignee}`); return cachedAnalysis; } // Stage 1: Get base workload analysis const baseAnalysis = await this.apiClient.getWorkloadAnalysis(assignee); // Stage 2: Enhance with proactive insights const enhancedAnalysis = await this.enhanceWorkloadAnalysis(baseAnalysis); // Stage 3: Add predictive modeling enhancedAnalysis.prediction = await this.generateWorkloadPrediction(enhancedAnalysis); // Stage 4: Add team context enhancedAnalysis.teamContext = await this.generateTeamContext(enhancedAnalysis); // CACHE: Store enhanced analysis await CacheService.set(cacheKey, enhancedAnalysis, this.ANALYSIS_CACHE_TTL); const processingTime = Date.now() - startTime; this.debug(`Workload analysis completed for ${assignee} in ${processingTime}ms`); return enhancedAnalysis; } catch (error) { this.debug(`Workload analysis failed for ${assignee}: ${error}`); throw error; } }